<?php
  /**
  * Wards List (Province's wards details)
  * @author: trungdt
  * @version: 1.0
  * For HuyBDS Project
  * 
  */
  if (!defined('EXPONENT')) exit('');
  
  $id = -1;
  if (isset($_REQUEST['id']))
  {
      $id=intval($_REQUEST['id']);
  }
  // Administrator access restrict
  if (exponent_users_isAdmin())
  {
    // set flow
    exponent_flow_set(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);
    $province=$db->selectObject("provinces","id = {$id}");
    if (!$province)
    {
         echo SITE_403_HTML;
    }
    else
    {
        $data=$db->selectObjects("provinces_wards","pid = {$id}");
        $template=new template("rsmanagemodule","_wards_management");
        $template->assign("data",$data);
        $template->assign("province_name",$province->name);
        $template->assign("id",$id);
        $template->register_permissions(array("administrate"),$loc);
        $template->output();
    }
  }
  else
  {
      echo SITE_403_HTML;
  }
?>
